#!/usr/bin/env python3

import sys
import datetime
import os
import subprocess
import re  # 正则
import os.path


print("\n")
print("-----------------start------------------------")
print("run in host pc !!!!!!!!")
print("do package and upload")
print("\n\n")

# sud_all_ver=sys.argv[1]
# src_localization_repo_dir=sys.argv[2]
# pakcages_root_dir=sys.argv[3]


ws_root="/home/nio/repos/localization/sud_release_res"
pakcages_root_dir=ws_root+"/packages"
os.system('sudo chown -R $(whoami) %s'%(pakcages_root_dir))




# src_localization_repo_dir=ws_root+"/localization"
# src_conf_dir=src_localization_repo_dir+                         "/conf"
# src_inc_dir =src_localization_repo_dir+"/src/cosine_ws/install"+"/include/localization_module"
# src_lib_dir =src_localization_repo_dir+"/src/cosine_ws/install"+"/lib"

# arch="aarch64"
# # release_type="debug"
# release_type="release"
# commit_id="ea440c6d8e4a5dc9a325301ba52240bf354cdd9b"
# sud_all_ver = "1221"
# ver_name="localization-localization-"+datetime.datetime.now().strftime('%Y%m%d.%H%M')[2:]+"-"+arch+"-"+release_type+"-"+sud_all_ver+"-"+commit_id

# pakcages_root_dir=ws_root+"/packages"
# package_root_dir=pakcages_root_dir+"/"+ver_name
# print("[time]", datetime.datetime.now().strftime('%Y%m%d.%H%M')[2:],
#               "[line]", sys._getframe().f_lineno,
#               "[file]", os.path.abspath(__file__)[os.path.abspath(__file__).rfind("/") + 1:],
#               "ver_name is ", ver_name
#               )
# if os.path.exists(package_root_dir):
#   print ("[line]", sys._getframe().f_lineno,"\n",
#         " package dir 已经存在 删除 新建 !!!!!!!!!"
#        )
#   os.system("rm -rf %s"%(package_root_dir))

# os.makedirs(package_root_dir)
# os.makedirs(package_root_dir+"/conf")
# os.makedirs(package_root_dir+"/include")
# os.makedirs(package_root_dir+"/lib")

# # # 命令部分 双引号单引号都可以
# os.system("cp -rf %s %s"%(src_conf_dir+"/"+"*", package_root_dir+"/"+"conf"))
# os.system("cp -rf %s %s"%(src_inc_dir+"/"+"*", package_root_dir+"/"+"include"))
# os.system("cp -rf %s %s"%(src_lib_dir+"/"+"*", package_root_dir+"/"+"lib"))

# os.system("cd %s && tar -czf %s.tar.gz %s"%(pakcages_root_dir, ver_name, ver_name))

